package com.lt.accesscontrolmanager.controller;

import com.lt.accesscontrolmanager.domain.Building;
import com.lt.accesscontrolmanager.service.BuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/building")
@CrossOrigin(origins = "http://localhost:5173/")
public class BuildingController {

    @Autowired
    private BuildingService buildingService;


    @GetMapping("/loadData")
    public List<Building> loadBuilding() {
        return buildingService.selectData();
    }
}
